﻿function SetJqGridSearchData(tableid, sdata) {
    var postData = $("#" + tableid).jqGrid("getGridParam", "postData");
    $.extend(postData, sdata);
    return $("#" + tableid).jqGrid("setGridParam", { search: true, page: 1 });
}
function ClearJqGridSearchData(tableid) {
    var sdata = {
        searchField: "",
        searchString: "",
        searchOper: "",
        filters: ""
    };

    var postData = $("#" + tableid).jqGrid("getGridParam", "postData");

    $.extend(postData, sdata);
    return $("#" + tableid).jqGrid("setGridParam", { search: false ,page:1});
}
function GetJsonString(json) {
    return this.xmlJsonClass.toJson(json, '', '')
}
function AddRuler(filter, field, op, data) {
    if (!filter.rules) {
        filter.rules = [];
    }
    filter.rules[filter.rules.length] = { "field": field, "op": op, "data": data };
}
function AddGroupFilter(filter, groupOp) {
    if (!filter.groups) {
        filter.groups = [];
    }
    filter.groups[filter.groups.length] = { "groupOp": groupOp };
    return filter.groups[filter.groups.length - 1];
}